import http from '@/api/request';

export const getGoodsCart = (page: number, limit: number) => {
  return http.request({
    method: 'GET',
    url: '/app/goods/cart_list',
    params: { page_size: limit, page: page },
  });
};

export const getGoodsCartNum = () => {
  return http.request({
    method: 'GET',
    url: '/app/goods/cart_num',
  });
};

export const addGoodsCart = (goods_id: number, goods_specs_id: number, goods_num: number) => {
  return http.request({
    method: 'POST',
    url: '/app/goods/cart_create',
    data: { goods_id: goods_id, goods_specs_id: goods_specs_id, goods_num: goods_num },
  });
};

export const setGoodsCart = (cart_id: number, goods_specs_id: number, goods_num: number) => {
  return http.request({
    method: 'POST',
    url: '/app/goods/cart_update',
    data: { id: cart_id, goods_specs_id: goods_specs_id, goods_num: goods_num },
  });
};

export const delGoodsCart = (cart_ids: string[] | number[]) => {
  return http.request({
    method: 'POST',
    url: '/app/goods/cart_delete',
    data: { id: cart_ids },
  });
};
